﻿$(document).ready(function () {
    var url = window.singleConfig.rootUrl + "api/common/WeixinService/getToken";
    $.get(url, { url: location.href }, function (result) {
        //console.log(result);

        var configdata = {
            debug: true, 
            appId: result.appId, 
            timestamp: result.timestamp, 
            nonceStr: result.noncestr, 
            signature: result.signature,
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage'] 
        };
        console.log(configdata);

        wx.config({
            debug: false,
            appId: result.appId,
            timestamp: result.timestamp,
            nonceStr: result.noncestr,
            signature: result.signature,
            jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage']
        });

        wx.ready(function () {


            wx.onMenuShareTimeline({
                title: '悦动冲锋，萌聚嘉季',
                link: 'http://aodonglianchuang.com/bmw/User/join', 
                imgUrl: 'http://aodonglianchuang.com/bmw/public/images/share_logo.jpg',
                success: function () {
                    
                },
                cancel: function () {
                    
                }
            });
            wx.onMenuShareAppMessage({
                title: '悦动冲锋，萌聚嘉季',
                desc: '2019BMW 5系 小海豚平衡车超级联赛杭州嘉里中心站',
                link: 'http://aodonglianchuang.com/bmw/User/join',
                imgUrl: 'http://aodonglianchuang.com/bmw/public/images/share_logo.jpg',
                type: '', 
                dataUrl: '', 
                success: function () {
                    
                },
                cancel: function () {
                    
                }
            });
        });

        wx.error(function (res) {
            

        });

    }, "json");
});